<extend name="public@base5"/>
<block name="head">
    <link href="__STATIC__/css/mall.css" rel="stylesheet">
</block>
<block name="main">
<script type="text/html" id="photos-item-tpl">
    <li id="saved-image{id}">
        <input id="photo-{id}" type="hidden" name="item_images[]" value="{filepath}">
        <input class="form-control" id="photo-{id}-name" type="text" name="image_names[]" value="{name}"
               style="width: 200px;" title="图片名称">
        <img id="photo-{id}-preview" src="{url}" style="height:34px;width: 44px;"
             onclick="imagePreviewDialog(this.src);">
        <a class="btn btn-default" href="javascript:uploadOneImage('图片上传','#photo-{id}');"><i class="fa fa-upload fa-fw"></i></a>
        <a class="btn btn-danger" href="javascript:(function(){$('#saved-image{id}').remove();})();"><i class="fa fa-trash fa-fw"></i></a>
        <a class="btn btn-success" href="javascript:(function(){$('#saved-image{id}').before($('#saved-image{id}').next());})();"><i class="fa fa-arrow-down fa-fw"></i></a>
    </li>
</script>
    <div class="wrap">
        <ul class="nav nav-tabs">
                <li class="nav-item">
                    <a class="nav-link" href="{:url('Store/booth',['bid'=>$booth_type])}">展位列表</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link active" href="">编辑展位</a>
                </li>
        </ul>
        <form method="post" class="js-ajax-form margin-top-20" action="admin/digital/save">
            <input type="hidden" name="id" value="{$id}">
                <div class="row mb-3">
                    <label for="input-item_name" class="col-sm-2 col-form-label text-sm-end"><span class="form-required">*</span>展位名称</label>
                    <div class="col-md-2 col-sm-4">
                        <input type="text" class="form-control" id="input-item_name" name="booth_name" value="{$booth_name}" disabled>
                    </div>
                </div>
            <div class="row mb-3">
                <label for="input-item_type" class="col-sm-2 col-form-label text-sm-end"><span class="form-required">*</span>按钮名称</label>
                <div class="col-md-2 col-sm-2">
                    <input type="text" class="form-control" id="input-item_type" name="button_name" value="{$button_name}" >
                </div>
            </div>
            <div class="row mb-3">
                <label for="input-booth_type" class="col-sm-2 col-form-label text-sm-end"><span class="form-required">*</span>展位类型</label>
                <div class="col-md-2 col-sm-2">
                    <input type="text" class="form-control" id="input-booth_type" name="booth_class" placeholder="展位类型" value="{$booth_class}" disabled>
                </div>

            </div>  
            <div class="row mb-3">
                    <label for="thumbnail-preview" class="col-sm-2 col-form-label text-sm-end pt-0"><span class="form-required">*</span>上传图标</label>
                    <div class="col-md-8 col-sm-10">
                        <input type="hidden" name="icon" id="item_icon" value="{$icon}">
                        <a href="javascript:uploadOneImage('图片上传','#item_icon');"><if condition="empty($icon)">
                                <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                     id="item_icon-preview"
                                     width="135" style="cursor: pointer"/>
                                <else/>
                                <img src="{:cmf_get_image_preview_url($icon)}"
                                     id="item_icon-preview"
                                     width="135" style="cursor: pointer"/>
                            </if>
                        </a>
                        <br>
                    </div>
            </div>
            <div class="row mb-3">
                    <label for="thumbnail-preview" class="col-sm-2 col-form-label text-sm-end pt-0"><span class="form-required">*</span>上传模型</label>
                    <div class="col-md-8 col-sm-10">
                        <input type="hidden" name="model_url" id="model_url" value="{$model_url}">
                        <notEmpty name="model_url"><a class="btn btn-info" href="{:cmf_get_image_url($model_url)}">下载模型</a>
                            <a class="btn btn-danger js-ajax-delete" href="{:url('delete_bmodel',['id'=>$id])}">删除</a></notEmpty>
                        <a class="btn btn-warning" href="javascript:uploadOne('上传模型','#model_url');">上传模型</a>                        
                    </div>
            </div>
            
<?php /*--            <div class="row mb-3">
                    <label for="input-item_type" class="col-sm-2 col-form-label text-sm-end"><span class="form-required">*</span>使用藏品模型</label>
                    <div class="col-md-2 col-sm-4">
                        <input type="checkbox" class="custom-control-input" name="use_item_icon" id="use_item_icon" <if condition="$use_item_icon eq 1">checked</if>>
                        <label class="custom-control-label" for="use_item_icon">使用藏品模型</label>
                    </div>
            </div>
            
            <div class="row mb-3">
                    <label for="input-item_desc" class="col-sm-2 col-form-label text-sm-end"><span class="form-required">*</span>选择藏品</label>
                    <div class="col-md-2 col-sm-4">
                        <empty name="item">
                             <input type="button" value="选择藏品" class="form-control js-select_item" name="item_id"/>
                        </empty>
                        <notEmpty name="item">
                            <input type="button" value="重新选择藏品" class="form-control js-select_item" name="item_id"/>
                            <div class="mt-2">当前关联藏品:<a href="{:url('store/edit',['id'=>$item['id']])}" class="btn btn-danger">{$item['item_name']}</a></div>
                           
                        </notEmpty> 
                    </div>
                    
            </div>--*/?>

            <div class="row mb-3">
                    <div class="offset-md-2 col-sm-10">
                            <button type="submit" class="btn btn-primary js-ajax-submit">
                                    <i class="fa fa-save fa-fw"></i> {:lang('SAVE')}
                            </button>
                    </div>
            </div>
        </form>

    </div>
</block>

<block name="scripts">
    <script src="__STATIC__/js/mall.js"></script>
</block>
